Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
JS: Variable declared with let, but got "undefined" Error when calling it

Sorry if this question is stupid, I am normally not doing any frontend stuff and am kind of a noob with JS.

In Firefox DevTools I see the following error message:

Uncaught TypeError: tabHeader is undefined

I have the following code:

let tabHeader=document.getElementsByClassName('tab-header')[0];

let tabsPane=tabHeader.getElementsByTagName('div');

I declared one variable using let, but it still gets read as "undefined"; Further more, if I use consol.log(tabHeader) I also get undefined as output in the console. I am sure this is easy and I am just being a noob, but what am I doing wrong here?

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda